/*
 * JVM_Logger.h
 *
 *  Created on: 20.04.2011
 *      Author: Dominik Ollesz
 */

#include <stdint.h>

#include "JVM_StackFrame.h"
#include "JVM_Opcode.h"

#include "JVM_Logger.h"
#include "Console.h"

uint16_t JVM_Logger_dumpMemoryStatus() {
		JVM_StackFrame_t* myStackFrame;

		myStackFrame = JVM_Opcode_getActiveStackFrame();

		// count stack frames
		int stacks = 1;
		while(myStackFrame->previus != NULL) {
			myStackFrame = (JVM_StackFrame_t*) myStackFrame->previus;
			stacks++;
		}

		// TODO Domi: implement better solution
		Console_putCharWait('D');
		Console_putCharWait('U');
		Console_putCharWait('M');
		Console_putCharWait('P');
	  Console_putCharWait(stacks);

	  return (STCD_OK);
}
